import type R from '@/types/conduit/R'
import type { PageResponse } from '@/types/generic/PageResponse'
import type FollowShopPage from '@/types/param/shop'
import type { ShopSurfaceInfo } from '@/types/response/shop'
import request from '@/utils/request'

/**
 * 关注/取消关注店铺
 */
export const followUnfollowShop = (shopId: number | string, isFollow: boolean): Promise<R<null>> =>
  request({
    url: `/shop/shop-collect/followUnfollowShop/${shopId}/${isFollow}`,
    method: 'POST'
  })

/**
 * 查出用户关注的店铺-关注时间降序
 */
export const getAllFollow = (pageDTO: FollowShopPage): Promise<R<PageResponse<ShopSurfaceInfo>>> =>
  request({
    url: `/shop/shop/allFollow`,
    method: 'GET',
    params: pageDTO
  })
